[feat/MAT-360] 입력 어댑터 패턴 + 지우개 bounds 최적화#302
Open
b0nsu wants to merge 1 commit intorefactor/mat-358-undo-redofrom
Open
[feat/MAT-360] 입력 어댑터 패턴 + 지우개 bounds 최적화#302b0nsu wants to merge 1 commit intorefactor/mat-358-undo-redofrom
b0nsu wants to merge 1 commit intorefactor/mat-358-undo-redofrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
터치/펜 입력을 추상화하기 위해 “입력 어댑터 패턴”을 도입하고, 지우개 히트 테스트를 StrokeBounds 기반으로 최적화해 point-level 비교를 크게 줄이려는 PR입니다.
Changes:
- 입력 추상화를 위한
InputEvent,InputPhase/CancelReason,InputAdapter*타입 및 RNGH Pan 기반 어댑터 훅 추가 DrawingCanvas에서 기존 Pan 제스처 로직을 어댑터로 치환- 지우개 삭제 판정에
StrokeBounds를 활용해 불필요한 stroke point 스캔을 스킵
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/pointer-native-drawing/src/model/drawingTypes.ts | 입력 이벤트/포인터 타입을 모델 레벨 타입으로 추가 |
| packages/pointer-native-drawing/src/input/inputTypes.ts | 입력 단계/취소 사유/콜백 인터페이스 정의 |
| packages/pointer-native-drawing/src/input/inputAdapterTypes.ts | 어댑터 config/state/반환 타입 정의 |
| packages/pointer-native-drawing/src/input/rnghPanAdapter.ts | RNGH Pan 제스처를 DrawingInputCallbacks로 브릿지하는 어댑터 훅 추가 |
| packages/pointer-native-drawing/src/DrawingCanvas.tsx | Pan 입력 처리 어댑터로 교체 + 지우개 bounds 기반 최적화 및 bounds ref 동기화 |
| packages/pointer-native-drawing/src/index.ts | 신규 타입/훅 export 정리 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+10
to
+14
| const RNGH_POINTER_TYPE_MAP: Record<number, PointerType> = { | ||
| 0: 'touch', | ||
| 1: 'pen', | ||
| 2: 'mouse', | ||
| }; |
Comment on lines
+39
to
+45
| const phaseShared = useSharedValue<InputPhase>('idle'); | ||
| const phaseRef = useRef<InputPhase>('idle'); | ||
|
|
||
| const eraserModeShared = useSharedValue(eraserMode); | ||
| eraserModeShared.value = eraserMode; | ||
| const pencilOnlyShared = useSharedValue(pencilOnly); | ||
| pencilOnlyShared.value = pencilOnly; |
| (phaseShared.value === 'began' || phaseShared.value === 'active') | ||
| ) { | ||
| phaseShared.value = 'cancelled'; | ||
| runOnJS(handleDrawCancel)('gesture_failed' as CancelReason); |
- input/inputTypes.ts: CancelReason, DrawingInputCallbacks - input/inputAdapterTypes.ts: InputAdapterConfig, InputAdapter (state.phase 미노출 — consumer 0건) - input/rnghPanAdapter.ts: pan gesture 어댑터 - PointerType enum 매핑 (RnghPointerType.TOUCH/STYLUS/MOUSE) - 'gesture_failed' literal (불필요한 as CancelReason 제거) - model/drawingTypes.ts: PointerType, InputEvent 추가 - DrawingCanvas.tsx: - pan inline → useRnghPanAdapter + DrawingInputCallbacks - eraseAtPoint AABB 사전 검사 — bounds + eraserSize 영역 밖 strokes 점 검사 skip Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6ecb49f to
51d4099
Compare
b0nsu
added a commit
that referenced
this pull request
May 8, 2026
…nvas iOS 통합
- ios/PencilGestureRecognizer.{h,m}: UIGestureRecognizer 서브클래스 (Apple Pencil precise + 240Hz coalesced + predicted touches)
- ios/StylusInputView.{h,mm}: Fabric component — UITouch 좌표/force/altitude/azimuth 패킹
- src/specs/StylusInputViewNativeComponent.ts: codegen spec
- src/input/nativeStylusAdapter.tsx: native overlay 어댑터
- state.phase 외부 미노출 (consumer 0건 — PR #302 인터페이스와 일관)
- acceptFingerInput 미전달 (textbox 비활성화 정책 — native default false)
- pointer-native-drawing.podspec + package.json: codegen 등록
- DrawingCanvas.tsx: Platform 분기
- iOS = native overlay (240Hz pencil 풀 활용), rngh pan 비활성
- Android/Web = rngh pan 그대로
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
터치 입력을 추상화하는 어댑터 패턴을 도입하고, 지우개 히트 테스트에 StrokeBounds를 적용하여 ~20배 성능 개선합니다.
시나리오: 200 strokes에서 지우개 → bounds로 ~190 스킵 → point-level 비교 대폭 감소.
Linear
Changes
input/inputTypes.ts— InputPhase, CancelReason, DrawingInputCallbacksinput/inputAdapterTypes.ts— InputAdapterConfig, InputAdapterState, InputAdapterinput/rnghPanAdapter.ts— RNGH Pan 제스처 어댑터model/drawingTypes.ts— PointerType, InputEvent 타입 추가Testing
pnpm typecheck통과pnpm lint통과Risk / Impact